Make it work even when item 0 is a placeholder. (#125826) add an assertion
authorSoeren Sandmann <sandmann@daimi.au.dk>
Thu, 30 Oct 2003 17:08:49 +0000 (17:08 +0000)
committerSøren Sandmann Pedersen <ssp@src.gnome.org>
Thu, 30 Oct 2003 17:08:49 +0000 (17:08 +0000)
Thu Oct 30 17:57:53 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

* gtk/gtktoolbar.c (logical_to_physical): Make it work even when
item 0 is a placeholder. (#125826)
* tests/testtoolbar.c: add an assertion that
gtk_toolbar_get_nth_item (0) != NULL

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktoolbar.c
tests/testtoolbar.c

index b8c84fe0d6f26f0e9010072e157c69fce1449f97..f2f3d71e0b51d192ef8b627504b52890626a3db9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,14 @@
+Thu Oct 30 17:57:53 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (logical_to_physical): Make it work even when
+       item 0 is a placeholder. (#125826)
+       * tests/testtoolbar.c: add an assertion that 
+       gtk_toolbar_get_nth_item (0) != NULL
+
 Thu Oct 30 17:40:26 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtktoolbar.c (logical_to_physical): Make it work for
-       logical == 0.
+       logical == 0.(#125826)
 
 Thu Oct 30 16:20:58 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
index b8c84fe0d6f26f0e9010072e157c69fce1449f97..f2f3d71e0b51d192ef8b627504b52890626a3db9 100644 (file)
@@ -1,7 +1,14 @@
+Thu Oct 30 17:57:53 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (logical_to_physical): Make it work even when
+       item 0 is a placeholder. (#125826)
+       * tests/testtoolbar.c: add an assertion that 
+       gtk_toolbar_get_nth_item (0) != NULL
+
 Thu Oct 30 17:40:26 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtktoolbar.c (logical_to_physical): Make it work for
-       logical == 0.
+       logical == 0.(#125826)
 
 Thu Oct 30 16:20:58 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
index b8c84fe0d6f26f0e9010072e157c69fce1449f97..f2f3d71e0b51d192ef8b627504b52890626a3db9 100644 (file)
@@ -1,7 +1,14 @@
+Thu Oct 30 17:57:53 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (logical_to_physical): Make it work even when
+       item 0 is a placeholder. (#125826)
+       * tests/testtoolbar.c: add an assertion that 
+       gtk_toolbar_get_nth_item (0) != NULL
+
 Thu Oct 30 17:40:26 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtktoolbar.c (logical_to_physical): Make it work for
-       logical == 0.
+       logical == 0.(#125826)
 
 Thu Oct 30 16:20:58 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
index b8c84fe0d6f26f0e9010072e157c69fce1449f97..f2f3d71e0b51d192ef8b627504b52890626a3db9 100644 (file)
@@ -1,7 +1,14 @@
+Thu Oct 30 17:57:53 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (logical_to_physical): Make it work even when
+       item 0 is a placeholder. (#125826)
+       * tests/testtoolbar.c: add an assertion that 
+       gtk_toolbar_get_nth_item (0) != NULL
+
 Thu Oct 30 17:40:26 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtktoolbar.c (logical_to_physical): Make it work for
-       logical == 0.
+       logical == 0.(#125826)
 
 Thu Oct 30 16:20:58 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
index b8c84fe0d6f26f0e9010072e157c69fce1449f97..f2f3d71e0b51d192ef8b627504b52890626a3db9 100644 (file)
@@ -1,7 +1,14 @@
+Thu Oct 30 17:57:53 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtktoolbar.c (logical_to_physical): Make it work even when
+       item 0 is a placeholder. (#125826)
+       * tests/testtoolbar.c: add an assertion that 
+       gtk_toolbar_get_nth_item (0) != NULL
+
 Thu Oct 30 17:40:26 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtktoolbar.c (logical_to_physical): Make it work for
-       logical == 0.
+       logical == 0.(#125826)
 
 Thu Oct 30 16:20:58 2003  Soeren Sandmann  <sandmann@daimi.au.dk>
 
index 9095d2ed1ebc0fe3b9cc77de387e46543014c2d7..f6af3f869a71596f9070095fbca6b497b137ba36 100644 (file)
@@ -1797,19 +1797,22 @@ logical_to_physical (GtkToolbar *toolbar, gint logical)
   g_assert (logical >= 0);
   
   physical = 0;
-  for (list = priv->content; list && logical > 0; list = list->next)
+  for (list = priv->content; list; list = list->next)
     {
       ToolbarContent *content = list->data;
 
       if (!content->is_placeholder)
-       logical--;
+       {
+         if (logical == 0)
+           break;
+         logical--;
+       }
+      
       physical++;
-
-      if (!content->is_placeholder && logical == 0)
-       break;
     }
-  
+
   g_assert (logical == 0);
+  
   return physical;
 }
 
index 04ec128a6fdbc69ffb2013e8a2fff726d5748bbb..0388ee4be7830fb7e68d7c95c4bd83be36e533b7 100644 (file)
@@ -625,12 +625,14 @@ main (gint argc, gchar **argv)
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
   gtk_tool_item_set_expand (item, TRUE);
   gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE);
-
+  g_assert (gtk_toolbar_get_nth_item (toolbar, 0) != 0);
+  
   item = gtk_radio_tool_button_new_from_stock (NULL, GTK_STOCK_JUSTIFY_LEFT);
   group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
   add_item_to_list (store, item, "Left");
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
   
+  
   item = gtk_radio_tool_button_new_from_stock (group, GTK_STOCK_JUSTIFY_CENTER);
 #if 0
   make_prop_editor (G_OBJECT (item));